

// 判断闰年
function isLeapYear(year) {
    if (isNaN(year)) {
        return false;
    }
    if (year % 4 == 0 && year % 100 != 0) {
        return true;
    }
    if (year % 400 == 0) {
        return true;
    }
    return false;
}

console.log(isLeapYear(1996));


var myDates = ['MON', 'TUE', 'WED', 'THU'];

for (let index = 0; index < myDates.length; index++) {
	
	switch (myDates[index]) {
		case 'MON':
			console.log("vegetable");
			break;
		case 'TUE':
			console.log("meat");
			break;
		case 'WED':
			console.log("fish");
			break;
		default:
			console.log("nothing");
	}
}

// 索引数组
var assArray = new Array();
assArray['name'] = 'gavin';
assArray['age'] = 25;
assArray['job'] = 'teacher';

// length属性失效
for (const key in assArray) {
    if (assArray.hasOwnProperty(key)) {
        const element = assArray[key];
        console.log(element);        
    }
}